from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # 点击搜索框
    # ID 定位
    def sou(self):
        loc = (By.ID,'cn.xuexi.android:id/text')
        ele = self.find_ele(loc)
        return ele

    # 输入要搜索的内容
    # CLASS_NAME 定位
    def shu(self):
        loc = (By.CLASS_NAME,'android.widget.EditText')
        ele = self.find_ele(loc)
        return ele

    # 点击二十大报告
    # XPATH resource-id 定位
    def ershi(self):
        loc = (By.XPATH,'//android.widget.TextView[@resource-id="cn.xuexi.android:id/tv" and @text="二十大报告"]')
        ele = self.find_ele(loc)
        return ele

    # 清除查询
    # ACCESSIBILITY_ID 定位
    def qingchu(self):
        loc = (By.ACCESSIBILITY_ID,'清除查询')
        ele = self.find_ele(loc)
        return ele

    # 点赞
    # XPATH text 定位
    def dianzan(self):
        loc = (By.XPATH,'//android.widget.TextView[@text=""]')
        ele = self.find_ele(loc)
        return ele

    # 异常处理
    def yichang(self):
        loc = (By.XPATH, '//android..TextView[@text=""]')
        ele = self.find_ele(loc)
        return ele

    # 断言
    def duanyan(self):
        loc = (By.XPATH,'//android.widget.TextView[@resource-id="cn.xuexi.android:id/tv" and @text="强国同学汇"]')
        ele = self.find_ele(loc)
        return ele







    # 点击删除按钮
    def shan(self):
        loc = (By.ID,'cn.xuexi.android:id/titleTail')
        ele = self.find_ele(loc)
        return ele

    # 点击确认
    def queren(self):
        loc = (By.XPATH,'//android.widget.TextView[@text="确认"]')
        ele = self.find_ele(loc)
        return ele







    # 返回
    def fanhui(self):
        loc = (By.ID,'cn.xuexi.android:id/search_back')
        ele = self.find_ele(loc)
        return ele

    # 断言
    def duanyan2(self):
        loc = (By.XPATH,'//android.widget.TextView[@text="思想"]')
        ele = self.find_ele(loc)
        return ele